#include "ohos_media_constraints.h"

namespace ohoswebrtc {

rtc::scoped_refptr<OHOSMediaConstraints> OHOSMediaConstraints::Create(std::map<std::string, std::string> mandatory, std::map<std::string, std::string> optional) {
  return rtc::make_ref_counted<OHOSMediaConstraints>(mandatory, optional);
}

OHOSMediaConstraints::OHOSMediaConstraints(std::map<std::string, std::string> mandatory,
                                           std::map<std::string, std::string> optional) {
    for (const auto& it : mandatory) {
        webrtc::MediaConstraints::Constraint constraint(it.first, it.second);
        mandatory_.push_back(constraint);
    }
    for (const auto& it : optional) {
        webrtc::MediaConstraints::Constraint constraint(it.first, it.second);
        optional_.push_back(constraint);
    }
}

OHOSMediaConstraints::~OHOSMediaConstraints() {
  RTC_LOG(LS_INFO) << __FUNCTION__ << ": Dtor";
}

}  // namespace ohoswebrtc
